.class public Lcom/opongo/blogapp/manager/DatabaseManager;
.super Ljava/lang/Object;
.source "DatabaseManager.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/opongo/blogapp/manager/DatabaseManager$OpenHelper;
    }
.end annotation


# static fields
.field protected static final DATABASE_NAME:Ljava/lang/String; = "aba.db"

.field protected static final DATABASE_VERSION:I = 0xe

.field public static final DEBUG:Z

.field protected static final TAG:Ljava/lang/String;


# instance fields
.field protected db:Landroid/database/sqlite/SQLiteDatabase;

.field protected insertStmt:Landroid/database/sqlite/SQLiteStatement;

.field protected insertString:Ljava/lang/String;

.field protected openHelper:Landroid/database/sqlite/SQLiteOpenHelper;

.field protected tableName:Ljava/lang/String;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 44
    sget-boolean v0, Lcom/opongo/blogapp/AbaSettings;->DEBUG:Z

    sput-boolean v0, Lcom/opongo/blogapp/manager/DatabaseManager;->DEBUG:Z

    .line 45
    const-class v0, Lcom/opongo/blogapp/manager/DatabaseManager;

    invoke-virtual {v0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/opongo/blogapp/manager/DatabaseManager;->TAG:Ljava/lang/String;

    .line 41
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;)V
    .locals 1
    .parameter "context"

    .prologue
    .line 88
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 89
    const-string v0, ""

    iput-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->tableName:Ljava/lang/String;

    .line 90
    new-instance v0, Lcom/opongo/blogapp/manager/DatabaseManager$OpenHelper;

    invoke-direct {v0, p1}, Lcom/opongo/blogapp/manager/DatabaseManager$OpenHelper;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->openHelper:Landroid/database/sqlite/SQLiteOpenHelper;

    .line 92
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->openHelper:Landroid/database/sqlite/SQLiteOpenHelper;

    invoke-virtual {v0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V

    .line 94
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->openHelper:Landroid/database/sqlite/SQLiteOpenHelper;

    invoke-virtual {v0}, Landroid/database/sqlite/SQLiteOpenHelper;->getWritableDatabase()Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v0

    iput-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    .line 95
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Ljava/lang/String;)V
    .locals 1
    .parameter "context"
    .parameter "tableName"

    .prologue
    .line 79
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 80
    iput-object p2, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->tableName:Ljava/lang/String;

    .line 81
    new-instance v0, Lcom/opongo/blogapp/manager/DatabaseManager$OpenHelper;

    invoke-direct {v0, p1}, Lcom/opongo/blogapp/manager/DatabaseManager$OpenHelper;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->openHelper:Landroid/database/sqlite/SQLiteOpenHelper;

    .line 83
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->openHelper:Landroid/database/sqlite/SQLiteOpenHelper;

    invoke-virtual {v0}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V

    .line 85
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->openHelper:Landroid/database/sqlite/SQLiteOpenHelper;

    invoke-virtual {v0}, Landroid/database/sqlite/SQLiteOpenHelper;->getWritableDatabase()Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v0

    iput-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    .line 86
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)V
    .locals 2
    .parameter "context"
    .parameter "tableName"
    .parameter "sqlInsert"

    .prologue
    .line 61
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 62
    iput-object p2, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->tableName:Ljava/lang/String;

    .line 63
    new-instance v1, Lcom/opongo/blogapp/manager/DatabaseManager$OpenHelper;

    invoke-direct {v1, p1}, Lcom/opongo/blogapp/manager/DatabaseManager$OpenHelper;-><init>(Landroid/content/Context;)V

    iput-object v1, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->openHelper:Landroid/database/sqlite/SQLiteOpenHelper;

    .line 65
    iget-object v1, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->openHelper:Landroid/database/sqlite/SQLiteOpenHelper;

    invoke-virtual {v1}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V

    .line 68
    :try_start_0
    iget-object v1, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->openHelper:Landroid/database/sqlite/SQLiteOpenHelper;

    invoke-virtual {v1}, Landroid/database/sqlite/SQLiteOpenHelper;->getWritableDatabase()Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v1

    iput-object v1, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    .line 70
    iput-object p3, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertString:Ljava/lang/String;

    .line 71
    iget-object v1, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    invoke-virtual {v1, p3}, Landroid/database/sqlite/SQLiteDatabase;->compileStatement(Ljava/lang/String;)Landroid/database/sqlite/SQLiteStatement;

    move-result-object v1

    iput-object v1, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 77
    :goto_0
    return-void

    .line 72
    :catch_0
    move-exception v0

    .line 74
    .local v0, e:Ljava/lang/Exception;
    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_0
.end method

.method public constructor <init>(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;Landroid/database/sqlite/SQLiteOpenHelper;)V
    .locals 1
    .parameter "context"
    .parameter "tableName"
    .parameter "sqlInsert"
    .parameter "openHelper"

    .prologue
    .line 97
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 98
    iput-object p2, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->tableName:Ljava/lang/String;

    .line 99
    iput-object p4, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->openHelper:Landroid/database/sqlite/SQLiteOpenHelper;

    .line 101
    invoke-virtual {p4}, Landroid/database/sqlite/SQLiteOpenHelper;->close()V

    .line 103
    invoke-virtual {p4}, Landroid/database/sqlite/SQLiteOpenHelper;->getWritableDatabase()Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v0

    iput-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    .line 105
    iput-object p3, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertString:Ljava/lang/String;

    .line 106
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    invoke-virtual {v0, p3}, Landroid/database/sqlite/SQLiteDatabase;->compileStatement(Ljava/lang/String;)Landroid/database/sqlite/SQLiteStatement;

    move-result-object v0

    iput-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    .line 107
    return-void
.end method


# virtual methods
.method public beginTransaction()V
    .locals 1

    .prologue
    .line 128
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    invoke-virtual {v0}, Landroid/database/sqlite/SQLiteDatabase;->beginTransaction()V

    .line 129
    return-void
.end method

.method public bookmarkExists(J)Z
    .locals 7
    .parameter "id"

    .prologue
    const/4 v3, 0x1

    .line 248
    new-instance v4, Ljava/lang/StringBuilder;

    const-string v5, "SELECT id FROM bookmarks WHERE id = "

    invoke-direct {v4, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    .line 249
    invoke-virtual {v4, p1, p2}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v4

    .line 248
    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    .line 251
    .local v2, query:Ljava/lang/String;
    sget-boolean v4, Lcom/opongo/blogapp/manager/DatabaseManager;->DEBUG:Z

    if-eqz v4, :cond_0

    .line 252
    sget-object v4, Lcom/opongo/blogapp/manager/DatabaseManager;->TAG:Ljava/lang/String;

    new-instance v5, Ljava/lang/StringBuilder;

    const-string v6, "Executing query: "

    invoke-direct {v5, v6}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v5, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-static {v4, v5}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 254
    :cond_0
    invoke-virtual {p0, v2}, Lcom/opongo/blogapp/manager/DatabaseManager;->query(Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v0

    .line 255
    .local v0, cursor:Landroid/database/Cursor;
    invoke-interface {v0}, Landroid/database/Cursor;->getCount()I

    move-result v1

    .line 256
    .local v1, numOfRows:I
    invoke-interface {v0}, Landroid/database/Cursor;->close()V

    .line 258
    if-ne v1, v3, :cond_1

    .line 266
    :goto_0
    return v3

    .line 261
    :cond_1
    if-le v1, v3, :cond_2

    .line 262
    sget-boolean v3, Lcom/opongo/blogapp/manager/DatabaseManager;->DEBUG:Z

    if-eqz v3, :cond_2

    .line 263
    sget-object v3, Lcom/opongo/blogapp/manager/DatabaseManager;->TAG:Ljava/lang/String;

    const-string v4, "Found more than one item with same id!"

    invoke-static {v3, v4}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 266
    :cond_2
    const/4 v3, 0x0

    goto :goto_0
.end method

.method public cleanPosts()V
    .locals 2

    .prologue
    .line 579
    new-instance v0, Ljava/lang/StringBuilder;

    const-string v1, "DELETE FROM "

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v1, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->tableName:Ljava/lang/String;

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, " WHERE newpost = 0"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0, v0}, Lcom/opongo/blogapp/manager/DatabaseManager;->execQuery(Ljava/lang/String;)V

    .line 580
    new-instance v0, Ljava/lang/StringBuilder;

    const-string v1, "UPDATE "

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v1, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->tableName:Ljava/lang/String;

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, " SET newpost = 0"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0, v0}, Lcom/opongo/blogapp/manager/DatabaseManager;->execQuery(Ljava/lang/String;)V

    .line 581
    return-void
.end method

.method public cleanPosts(I)V
    .locals 3
    .parameter "blogtype"

    .prologue
    .line 584
    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "DELETE FROM post_blogtype WHERE newpost = 0 AND blogtype_id = "

    invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    .line 586
    .local v0, query:Ljava/lang/String;
    invoke-virtual {p0, v0}, Lcom/opongo/blogapp/manager/DatabaseManager;->execQuery(Ljava/lang/String;)V

    .line 588
    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "UPDATE post_blogtype SET newpost = 0 WHERE blogtype_id = "

    invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p0, v1}, Lcom/opongo/blogapp/manager/DatabaseManager;->execQuery(Ljava/lang/String;)V

    .line 590
    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "DELETE FROM "

    invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v2, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->tableName:Ljava/lang/String;

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    .line 591
    const-string v2, " WHERE id NOT IN (SELECT DISTINCT post_id FROM "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, "post_blogtype"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, " WHERE 1)"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    .line 590
    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    .line 593
    invoke-virtual {p0, v0}, Lcom/opongo/blogapp/manager/DatabaseManager;->execQuery(Ljava/lang/String;)V

    .line 594
    return-void
.end method

.method public close()V
    .locals 1

    .prologue
    .line 120
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    invoke-virtual {v0}, Landroid/database/sqlite/SQLiteDatabase;->close()V

    .line 121
    return-void
.end method

.method public count()J
    .locals 6

    .prologue
    .line 461
    new-instance v4, Ljava/lang/StringBuilder;

    const-string v5, "SELECT COUNT(*) FROM "

    invoke-direct {v4, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v5, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->tableName:Ljava/lang/String;

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    .line 462
    .local v2, query:Ljava/lang/String;
    iget-object v4, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    invoke-virtual {v4, v2}, Landroid/database/sqlite/SQLiteDatabase;->compileStatement(Ljava/lang/String;)Landroid/database/sqlite/SQLiteStatement;

    move-result-object v3

    .line 463
    .local v3, statement:Landroid/database/sqlite/SQLiteStatement;
    invoke-virtual {v3}, Landroid/database/sqlite/SQLiteStatement;->simpleQueryForLong()J

    move-result-wide v0

    .line 464
    .local v0, count:J
    return-wide v0
.end method

.method public endTransaction()V
    .locals 1

    .prologue
    .line 132
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    invoke-virtual {v0}, Landroid/database/sqlite/SQLiteDatabase;->setTransactionSuccessful()V

    .line 133
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    invoke-virtual {v0}, Landroid/database/sqlite/SQLiteDatabase;->endTransaction()V

    .line 134
    return-void
.end method

.method public execQuery(Ljava/lang/String;)V
    .locals 3
    .parameter "sql"

    .prologue
    .line 169
    sget-boolean v0, Lcom/opongo/blogapp/manager/DatabaseManager;->DEBUG:Z

    if-eqz v0, :cond_0

    .line 170
    sget-object v0, Lcom/opongo/blogapp/manager/DatabaseManager;->TAG:Ljava/lang/String;

    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "Executing query: "

    invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 171
    :cond_0
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    invoke-virtual {v0, p1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 172
    return-void
.end method

.method public getCategoriesStatusAsJSON(Z)Ljava/lang/String;
    .locals 11
    .parameter "categoryForPush"

    .prologue
    const/4 v9, 0x0

    .line 734
    const-string v8, "SELECT id, cat_show_enable FROM categories;"

    .line 736
    .local v8, query:Ljava/lang/String;
    if-eqz p1, :cond_0

    .line 737
    const-string v8, "SELECT id, cat_enable FROM categories;"

    .line 741
    :cond_0
    invoke-virtual {p0, v8}, Lcom/opongo/blogapp/manager/DatabaseManager;->query(Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v0

    .line 742
    .local v0, c:Landroid/database/Cursor;
    if-eqz v0, :cond_1

    .line 744
    invoke-interface {v0}, Landroid/database/Cursor;->getCount()I

    move-result v10

    if-nez v10, :cond_2

    .line 745
    invoke-interface {v0}, Landroid/database/Cursor;->close()V

    .line 767
    :cond_1
    :goto_0
    return-object v9

    .line 749
    :cond_2
    new-instance v5, Ljava/util/HashMap;

    invoke-direct {v5}, Ljava/util/HashMap;-><init>()V

    .line 751
    .local v5, cats:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;Ljava/lang/Integer;>;"
    const/4 v6, 0x0

    .local v6, i:I
    :goto_1
    invoke-interface {v0}, Landroid/database/Cursor;->getCount()I

    move-result v9

    if-lt v6, v9, :cond_3

    .line 762
    invoke-interface {v0}, Landroid/database/Cursor;->close()V

    .line 763
    new-instance v7, Lorg/json/JSONObject;

    invoke-direct {v7, v5}, Lorg/json/JSONObject;-><init>(Ljava/util/Map;)V

    .line 765
    .local v7, json_object:Lorg/json/JSONObject;
    invoke-virtual {v7}, Lorg/json/JSONObject;->toString()Ljava/lang/String;

    move-result-object v9

    goto :goto_0

    .line 752
    .end local v7           #json_object:Lorg/json/JSONObject;
    :cond_3
    invoke-interface {v0}, Landroid/database/Cursor;->moveToNext()Z

    .line 754
    const-string v9, "id"

    invoke-interface {v0, v9}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v2

    .line 755
    .local v2, catIdIndex:I
    if-eqz p1, :cond_4

    const-string v9, "cat_enable"

    invoke-interface {v0, v9}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v1

    .line 757
    .local v1, catEnableIndex:I
    :goto_2
    invoke-interface {v0, v2}, Landroid/database/Cursor;->getInt(I)I

    move-result v4

    .line 758
    .local v4, cat_id:I
    invoke-interface {v0, v1}, Landroid/database/Cursor;->getInt(I)I

    move-result v3

    .line 760
    .local v3, cat_enable:I
    invoke-static {v4}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v9

    invoke-static {v3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v10

    invoke-interface {v5, v9, v10}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 751
    add-int/lit8 v6, v6, 0x1

    goto :goto_1

    .line 755
    .end local v1           #catEnableIndex:I
    .end local v3           #cat_enable:I
    .end local v4           #cat_id:I
    :cond_4
    const-string v9, "cat_show_enable"

    invoke-interface {v0, v9}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v1

    goto :goto_2
.end method

.method public getTableName()Ljava/lang/String;
    .locals 1

    .prologue
    .line 113
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->tableName:Ljava/lang/String;

    return-object v0
.end method

.method public insertCats(Lorg/json/JSONArray;)Z
    .locals 10
    .parameter "cats"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lorg/json/JSONException;
        }
    .end annotation

    .prologue
    const/4 v3, 0x0

    const/4 v4, 0x1

    .line 689
    iget-object v5, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    invoke-virtual {v5}, Landroid/database/sqlite/SQLiteDatabase;->isOpen()Z

    move-result v5

    if-nez v5, :cond_1

    .line 729
    :cond_0
    :goto_0
    return v3

    .line 692
    :cond_1
    if-eqz p1, :cond_0

    .line 694
    const/4 v1, 0x0

    .local v1, i:I
    :goto_1
    :try_start_0
    invoke-virtual {p1}, Lorg/json/JSONArray;->length()I

    move-result v3

    if-lt v1, v3, :cond_2

    .line 721
    const-string v3, "DELETE FROM categories WHERE cat_new = 0"

    invoke-virtual {p0, v3}, Lcom/opongo/blogapp/manager/DatabaseManager;->execQuery(Ljava/lang/String;)V

    .line 722
    const-string v3, "UPDATE categories SET cat_new = 0"

    invoke-virtual {p0, v3}, Lcom/opongo/blogapp/manager/DatabaseManager;->execQuery(Ljava/lang/String;)V

    :goto_2
    move v3, v4

    .line 727
    goto :goto_0

    .line 695
    :cond_2
    invoke-virtual {p1, v1}, Lorg/json/JSONArray;->getJSONObject(I)Lorg/json/JSONObject;

    move-result-object v0

    .line 697
    .local v0, cat:Lorg/json/JSONObject;
    sget-boolean v3, Lcom/opongo/blogapp/manager/DatabaseManager;->DEBUG:Z

    if-eqz v3, :cond_3

    sget-object v3, Lcom/opongo/blogapp/manager/DatabaseManager;->TAG:Ljava/lang/String;

    invoke-virtual {v0}, Lorg/json/JSONObject;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-static {v3, v5}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 699
    :cond_3
    const-string v3, "cat_ID"

    invoke-virtual {v0, v3}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v3

    int-to-long v5, v3

    invoke-virtual {p0, v5, v6}, Lcom/opongo/blogapp/manager/DatabaseManager;->itemExists(J)Z

    move-result v3

    if-nez v3, :cond_4

    .line 700
    iget-object v3, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/4 v5, 0x1

    const-string v6, "cat_ID"

    invoke-virtual {v0, v6}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v6

    int-to-long v6, v6

    invoke-virtual {v3, v5, v6, v7}, Landroid/database/sqlite/SQLiteStatement;->bindLong(IJ)V

    .line 701
    iget-object v3, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/4 v5, 0x2

    const-string v6, "cat_name"

    invoke-virtual {v0, v6}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v6

    invoke-virtual {v3, v5, v6}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 702
    iget-object v3, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/4 v5, 0x3

    const-string v6, "cat_parent"

    invoke-virtual {v0, v6}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v6

    int-to-long v6, v6

    invoke-virtual {v3, v5, v6, v7}, Landroid/database/sqlite/SQLiteStatement;->bindLong(IJ)V

    .line 703
    iget-object v3, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/4 v5, 0x4

    const-string v6, "cat_enable"

    invoke-virtual {v0, v6}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v6

    int-to-long v6, v6

    invoke-virtual {v3, v5, v6, v7}, Landroid/database/sqlite/SQLiteStatement;->bindLong(IJ)V

    .line 704
    iget-object v3, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/4 v5, 0x5

    const-wide/16 v6, 0x1

    invoke-virtual {v3, v5, v6, v7}, Landroid/database/sqlite/SQLiteStatement;->bindLong(IJ)V

    .line 705
    iget-object v3, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/4 v5, 0x6

    const-string v6, "cat_child_count"

    invoke-virtual {v0, v6}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v6

    int-to-long v6, v6

    invoke-virtual {v3, v5, v6, v7}, Landroid/database/sqlite/SQLiteStatement;->bindLong(IJ)V

    .line 706
    iget-object v3, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/4 v5, 0x7

    const-wide/16 v6, 0x1

    invoke-virtual {v3, v5, v6, v7}, Landroid/database/sqlite/SQLiteStatement;->bindLong(IJ)V

    .line 707
    iget-object v3, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    invoke-virtual {v3}, Landroid/database/sqlite/SQLiteStatement;->executeInsert()J

    .line 694
    :goto_3
    add-int/lit8 v1, v1, 0x1

    goto/16 :goto_1

    .line 710
    :cond_4
    new-instance v2, Landroid/content/ContentValues;

    invoke-direct {v2}, Landroid/content/ContentValues;-><init>()V

    .line 711
    .local v2, values:Landroid/content/ContentValues;
    const-string v3, "cat_name"

    const-string v5, "cat_name"

    invoke-virtual {v0, v5}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v5

    invoke-virtual {v2, v3, v5}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 712
    const-string v3, "cat_enable"

    const-string v5, "cat_enable"

    invoke-virtual {v0, v5}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v5

    invoke-static {v5}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v5

    invoke-virtual {v2, v3, v5}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 713
    const-string v3, "cat_new"

    const/4 v5, 0x1

    invoke-static {v5}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v5

    invoke-virtual {v2, v3, v5}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 714
    const-string v3, "cat_parent"

    const-string v5, "cat_parent"

    invoke-virtual {v0, v5}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v5

    invoke-static {v5}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v5

    invoke-virtual {v2, v3, v5}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 715
    const-string v3, "cat_child_count"

    const-string v5, "cat_child_count"

    invoke-virtual {v0, v5}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v5

    invoke-static {v5}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v5

    invoke-virtual {v2, v3, v5}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 716
    iget-object v3, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    iget-object v5, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->tableName:Ljava/lang/String;

    const-string v6, "id=?"

    const/4 v7, 0x1

    new-array v7, v7, [Ljava/lang/String;

    const/4 v8, 0x0

    .line 717
    const-string v9, "cat_ID"

    invoke-virtual {v0, v9}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v9

    invoke-static {v9}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v9

    aput-object v9, v7, v8

    .line 716
    invoke-virtual {v3, v5, v2, v6, v7}, Landroid/database/sqlite/SQLiteDatabase;->update(Ljava/lang/String;Landroid/content/ContentValues;Ljava/lang/String;[Ljava/lang/String;)I
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_3

    .line 723
    .end local v0           #cat:Lorg/json/JSONObject;
    .end local v2           #values:Landroid/content/ContentValues;
    :catch_0
    move-exception v3

    goto/16 :goto_2
.end method

.method public insertComment(Lcom/opongo/blogapp/common/Comment;)J
    .locals 4
    .parameter "comment"

    .prologue
    .line 623
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/4 v1, 0x1

    iget v2, p1, Lcom/opongo/blogapp/common/Comment;->id:I

    int-to-long v2, v2

    invoke-virtual {v0, v1, v2, v3}, Landroid/database/sqlite/SQLiteStatement;->bindLong(IJ)V

    .line 624
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/4 v1, 0x2

    iget v2, p1, Lcom/opongo/blogapp/common/Comment;->parent:I

    int-to-long v2, v2

    invoke-virtual {v0, v1, v2, v3}, Landroid/database/sqlite/SQLiteStatement;->bindLong(IJ)V

    .line 625
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/4 v1, 0x3

    iget v2, p1, Lcom/opongo/blogapp/common/Comment;->postId:I

    int-to-long v2, v2

    invoke-virtual {v0, v1, v2, v3}, Landroid/database/sqlite/SQLiteStatement;->bindLong(IJ)V

    .line 626
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/4 v1, 0x4

    iget-object v2, p1, Lcom/opongo/blogapp/common/Comment;->content:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 627
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/4 v1, 0x5

    iget-object v2, p1, Lcom/opongo/blogapp/common/Comment;->author:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 628
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/4 v1, 0x6

    iget-object v2, p1, Lcom/opongo/blogapp/common/Comment;->date:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 629
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/4 v1, 0x7

    iget-object v2, p1, Lcom/opongo/blogapp/common/Comment;->gravatarUrl:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 630
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    invoke-virtual {v0}, Landroid/database/sqlite/SQLiteStatement;->executeInsert()J

    move-result-wide v0

    return-wide v0
.end method

.method public insertPost(Lcom/opongo/blogapp/common/Post;)J
    .locals 4
    .parameter "post"

    .prologue
    .line 501
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/4 v1, 0x1

    iget v2, p1, Lcom/opongo/blogapp/common/Post;->id:I

    int-to-long v2, v2

    invoke-virtual {v0, v1, v2, v3}, Landroid/database/sqlite/SQLiteStatement;->bindLong(IJ)V

    .line 502
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/4 v1, 0x2

    iget-object v2, p1, Lcom/opongo/blogapp/common/Post;->title:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 503
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/4 v1, 0x3

    iget-object v2, p1, Lcom/opongo/blogapp/common/Post;->date:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 504
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/4 v1, 0x4

    iget-object v2, p1, Lcom/opongo/blogapp/common/Post;->content:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 505
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/4 v1, 0x5

    iget-object v2, p1, Lcom/opongo/blogapp/common/Post;->categories:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 506
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/4 v1, 0x6

    iget v2, p1, Lcom/opongo/blogapp/common/Post;->commentsCount:I

    int-to-long v2, v2

    invoke-virtual {v0, v1, v2, v3}, Landroid/database/sqlite/SQLiteStatement;->bindLong(IJ)V

    .line 507
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/4 v1, 0x7

    iget-object v2, p1, Lcom/opongo/blogapp/common/Post;->imageUrl:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 508
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/16 v1, 0x8

    iget v2, p1, Lcom/opongo/blogapp/common/Post;->order:I

    int-to-long v2, v2

    invoke-virtual {v0, v1, v2, v3}, Landroid/database/sqlite/SQLiteStatement;->bindLong(IJ)V

    .line 509
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/16 v1, 0x9

    iget-object v2, p1, Lcom/opongo/blogapp/common/Post;->guid:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 510
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/16 v1, 0xa

    iget v2, p1, Lcom/opongo/blogapp/common/Post;->opened:I

    int-to-long v2, v2

    invoke-virtual {v0, v1, v2, v3}, Landroid/database/sqlite/SQLiteStatement;->bindLong(IJ)V

    .line 511
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/16 v1, 0xb

    const-wide/16 v2, 0x1

    invoke-virtual {v0, v1, v2, v3}, Landroid/database/sqlite/SQLiteStatement;->bindLong(IJ)V

    .line 513
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/16 v1, 0xc

    const-wide/16 v2, 0x0

    invoke-virtual {v0, v1, v2, v3}, Landroid/database/sqlite/SQLiteStatement;->bindLong(IJ)V

    .line 514
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/16 v1, 0xd

    iget-object v2, p1, Lcom/opongo/blogapp/common/Post;->post_author:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Landroid/database/sqlite/SQLiteStatement;->bindString(ILjava/lang/String;)V

    .line 515
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/16 v1, 0xe

    iget-wide v2, p1, Lcom/opongo/blogapp/common/Post;->post_price:D

    invoke-virtual {v0, v1, v2, v3}, Landroid/database/sqlite/SQLiteStatement;->bindDouble(ID)V

    .line 516
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    const/16 v1, 0xf

    iget-wide v2, p1, Lcom/opongo/blogapp/common/Post;->post_rating:D

    invoke-virtual {v0, v1, v2, v3}, Landroid/database/sqlite/SQLiteStatement;->bindDouble(ID)V

    .line 518
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    invoke-virtual {v0}, Landroid/database/sqlite/SQLiteDatabase;->isDbLockedByOtherThreads()Z

    move-result v0

    if-nez v0, :cond_0

    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    invoke-virtual {v0}, Landroid/database/sqlite/SQLiteDatabase;->isDbLockedByCurrentThread()Z

    move-result v0

    if-eqz v0, :cond_1

    .line 519
    :cond_0
    sget-object v0, Lcom/opongo/blogapp/manager/DatabaseManager;->TAG:Ljava/lang/String;

    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "DBIsLocked: insertPost "

    invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget v2, p1, Lcom/opongo/blogapp/common/Post;->id:I

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    .line 521
    :cond_1
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->insertStmt:Landroid/database/sqlite/SQLiteStatement;

    invoke-virtual {v0}, Landroid/database/sqlite/SQLiteStatement;->executeInsert()J

    move-result-wide v0

    return-wide v0
.end method

.method public insertPostToBlogtype(JJI)J
    .locals 4
    .parameter "post_id"
    .parameter "blogType"
    .parameter "post_order"

    .prologue
    .line 551
    iget-object v1, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    const-string v2, "INSERT INTO post_blogtype (post_id,blogtype_id,newpost,post_order) VALUES (?,?,?,?);"

    invoke-virtual {v1, v2}, Landroid/database/sqlite/SQLiteDatabase;->compileStatement(Ljava/lang/String;)Landroid/database/sqlite/SQLiteStatement;

    move-result-object v0

    .line 552
    .local v0, insertBlogtype:Landroid/database/sqlite/SQLiteStatement;
    const/4 v1, 0x1

    invoke-virtual {v0, v1, p1, p2}, Landroid/database/sqlite/SQLiteStatement;->bindLong(IJ)V

    .line 553
    const/4 v1, 0x2

    invoke-virtual {v0, v1, p3, p4}, Landroid/database/sqlite/SQLiteStatement;->bindLong(IJ)V

    .line 554
    const/4 v1, 0x3

    const-wide/16 v2, 0x1

    invoke-virtual {v0, v1, v2, v3}, Landroid/database/sqlite/SQLiteStatement;->bindLong(IJ)V

    .line 555
    const/4 v1, 0x4

    int-to-long v2, p5

    invoke-virtual {v0, v1, v2, v3}, Landroid/database/sqlite/SQLiteStatement;->bindLong(IJ)V

    .line 557
    iget-object v1, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    invoke-virtual {v1}, Landroid/database/sqlite/SQLiteDatabase;->isDbLockedByOtherThreads()Z

    move-result v1

    if-nez v1, :cond_0

    iget-object v1, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    invoke-virtual {v1}, Landroid/database/sqlite/SQLiteDatabase;->isDbLockedByCurrentThread()Z

    move-result v1

    if-eqz v1, :cond_1

    .line 558
    :cond_0
    sget-object v1, Lcom/opongo/blogapp/manager/DatabaseManager;->TAG:Ljava/lang/String;

    new-instance v2, Ljava/lang/StringBuilder;

    const-string v3, "DBIsLocked: insertPostToBlogtype "

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v2, p1, p2}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    .line 560
    :cond_1
    invoke-virtual {v0}, Landroid/database/sqlite/SQLiteStatement;->executeInsert()J

    move-result-wide v1

    return-wide v1
.end method

.method public isLocked()Z
    .locals 1

    .prologue
    .line 124
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    invoke-virtual {v0}, Landroid/database/sqlite/SQLiteDatabase;->isDbLockedByOtherThreads()Z

    move-result v0

    return v0
.end method

.method public itemExists(J)Z
    .locals 7
    .parameter "id"

    .prologue
    const/4 v3, 0x1

    .line 180
    new-instance v4, Ljava/lang/StringBuilder;

    const-string v5, "SELECT id FROM "

    invoke-direct {v4, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v5, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->tableName:Ljava/lang/String;

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    const-string v5, " WHERE id = "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4, p1, p2}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    .line 182
    .local v2, query:Ljava/lang/String;
    sget-boolean v4, Lcom/opongo/blogapp/manager/DatabaseManager;->DEBUG:Z

    if-eqz v4, :cond_0

    .line 183
    sget-object v4, Lcom/opongo/blogapp/manager/DatabaseManager;->TAG:Ljava/lang/String;

    new-instance v5, Ljava/lang/StringBuilder;

    const-string v6, "Executing query: "

    invoke-direct {v5, v6}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v5, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-static {v4, v5}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 185
    :cond_0
    const/4 v1, 0x0

    .line 188
    .local v1, numOfRows:I
    :try_start_0
    invoke-virtual {p0, v2}, Lcom/opongo/blogapp/manager/DatabaseManager;->query(Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v0

    .line 189
    .local v0, cursor:Landroid/database/Cursor;
    invoke-interface {v0}, Landroid/database/Cursor;->getCount()I

    move-result v1

    .line 190
    invoke-interface {v0}, Landroid/database/Cursor;->close()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 197
    .end local v0           #cursor:Landroid/database/Cursor;
    :goto_0
    if-ne v1, v3, :cond_1

    .line 204
    :goto_1
    return v3

    .line 200
    :cond_1
    if-le v1, v3, :cond_2

    .line 201
    sget-object v3, Lcom/opongo/blogapp/manager/DatabaseManager;->TAG:Ljava/lang/String;

    const-string v4, "Found more than one item with same id!"

    invoke-static {v3, v4}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 204
    :cond_2
    const/4 v3, 0x0

    goto :goto_1

    .line 191
    :catch_0
    move-exception v4

    goto :goto_0
.end method

.method public itemExists(JI)Z
    .locals 7
    .parameter "id"
    .parameter "blogtype"

    .prologue
    const/4 v3, 0x1

    .line 215
    new-instance v4, Ljava/lang/StringBuilder;

    const-string v5, "SELECT * FROM post_blogtype WHERE post_id = "

    invoke-direct {v4, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v4, p1, p2}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v4

    const-string v5, " AND blogtype_id = "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4, p3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    .line 217
    .local v2, query:Ljava/lang/String;
    sget-boolean v4, Lcom/opongo/blogapp/manager/DatabaseManager;->DEBUG:Z

    if-eqz v4, :cond_0

    .line 218
    sget-object v4, Lcom/opongo/blogapp/manager/DatabaseManager;->TAG:Ljava/lang/String;

    new-instance v5, Ljava/lang/StringBuilder;

    const-string v6, "Executing query: "

    invoke-direct {v5, v6}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v5, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-static {v4, v5}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 220
    :cond_0
    const/4 v1, 0x0

    .line 223
    .local v1, numOfRows:I
    :try_start_0
    invoke-virtual {p0, v2}, Lcom/opongo/blogapp/manager/DatabaseManager;->query(Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v0

    .line 224
    .local v0, cursor:Landroid/database/Cursor;
    invoke-interface {v0}, Landroid/database/Cursor;->getCount()I

    move-result v1

    .line 225
    invoke-interface {v0}, Landroid/database/Cursor;->close()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 232
    .end local v0           #cursor:Landroid/database/Cursor;
    :goto_0
    if-ne v1, v3, :cond_1

    .line 239
    :goto_1
    return v3

    .line 235
    :cond_1
    if-le v1, v3, :cond_2

    .line 236
    sget-object v3, Lcom/opongo/blogapp/manager/DatabaseManager;->TAG:Ljava/lang/String;

    const-string v4, "Found more than one item with same id!"

    invoke-static {v3, v4}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 239
    :cond_2
    const/4 v3, 0x0

    goto :goto_1

    .line 226
    :catch_0
    move-exception v4

    goto :goto_0
.end method

.method public onRecreate()V
    .locals 2

    .prologue
    .line 780
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    const-string v1, "DROP TABLE IF EXISTS search_posts"

    invoke-virtual {v0, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 781
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    const-string v1, "CREATE TABLE search_posts (_id INTEGER PRIMARY KEY AUTOINCREMENT,id INTEGER,title TEXT NOT NULL,date TEXT NOT NULL,content TEXT NOT NULL,categories TEXT,commentscount INTEGER,imageurl TEXT,post_order INTEGER,guid TEXT,opened INTEGER,newpost INTEGER,did_vote INTEGER,post_author TEXT,post_price DOUBLE,post_rating DOUBLE);"

    invoke-virtual {v0, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 782
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    const-string v1, "CREATE UNIQUE INDEX idx_search_posts ON search_posts (id);"

    invoke-virtual {v0, v1}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 783
    return-void
.end method

.method public query(Ljava/lang/String;)Landroid/database/Cursor;
    .locals 4
    .parameter "sqlSelect"

    .prologue
    .line 151
    sget-boolean v1, Lcom/opongo/blogapp/manager/DatabaseManager;->DEBUG:Z

    if-eqz v1, :cond_0

    .line 152
    sget-object v1, Lcom/opongo/blogapp/manager/DatabaseManager;->TAG:Ljava/lang/String;

    new-instance v2, Ljava/lang/StringBuilder;

    const-string v3, "Executing query: "

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 154
    :cond_0
    const/4 v0, 0x0

    .line 157
    .local v0, c:Landroid/database/Cursor;
    :try_start_0
    iget-object v1, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    const/4 v2, 0x0

    invoke-virtual {v1, p1, v2}, Landroid/database/sqlite/SQLiteDatabase;->rawQuery(Ljava/lang/String;[Ljava/lang/String;)Landroid/database/Cursor;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v0

    .line 162
    :goto_0
    return-object v0

    .line 158
    :catch_0
    move-exception v1

    goto :goto_0
.end method

.method public queryForBlogTypeID(Ljava/lang/String;I)I
    .locals 6
    .parameter "tablename"
    .parameter "blogType"

    .prologue
    .line 441
    new-instance v3, Ljava/lang/StringBuilder;

    const-string v4, "SELECT _id FROM blogtyp WHERE tablename = \'"

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, "\' AND blogtype = "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    .line 443
    .local v2, query:Ljava/lang/String;
    sget-boolean v3, Lcom/opongo/blogapp/manager/DatabaseManager;->DEBUG:Z

    if-eqz v3, :cond_0

    .line 444
    sget-object v3, Lcom/opongo/blogapp/manager/DatabaseManager;->TAG:Ljava/lang/String;

    new-instance v4, Ljava/lang/StringBuilder;

    const-string v5, "Executing query: "

    invoke-direct {v4, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v4, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-static {v3, v4}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 446
    :cond_0
    const/4 v0, -0x1

    .line 447
    .local v0, blogType_id:I
    invoke-virtual {p0, v2}, Lcom/opongo/blogapp/manager/DatabaseManager;->query(Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v1

    .line 448
    .local v1, cursor:Landroid/database/Cursor;
    invoke-interface {v1}, Landroid/database/Cursor;->moveToFirst()Z

    move-result v3

    if-eqz v3, :cond_1

    .line 449
    const/4 v3, 0x0

    invoke-interface {v1, v3}, Landroid/database/Cursor;->getInt(I)I

    move-result v0

    .line 451
    :cond_1
    invoke-interface {v1}, Landroid/database/Cursor;->close()V

    .line 452
    return v0
.end method

.method public queryForCatChildCountByPrimary(I)I
    .locals 6
    .parameter "parent_id"

    .prologue
    .line 654
    new-instance v3, Ljava/lang/StringBuilder;

    const-string v4, "SELECT COUNT(*) FROM "

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    .line 655
    iget-object v4, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->tableName:Ljava/lang/String;

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, " WHERE cat_parent = "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v3

    .line 654
    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    .line 657
    .local v2, query:Ljava/lang/String;
    sget-boolean v3, Lcom/opongo/blogapp/manager/DatabaseManager;->DEBUG:Z

    if-eqz v3, :cond_0

    .line 658
    sget-object v3, Lcom/opongo/blogapp/manager/DatabaseManager;->TAG:Ljava/lang/String;

    new-instance v4, Ljava/lang/StringBuilder;

    const-string v5, "Executing query: "

    invoke-direct {v4, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v4, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-static {v3, v4}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 660
    :cond_0
    invoke-virtual {p0, v2}, Lcom/opongo/blogapp/manager/DatabaseManager;->query(Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v1

    .line 661
    .local v1, cursor:Landroid/database/Cursor;
    const/4 v0, -0x1

    .line 662
    .local v0, count:I
    invoke-interface {v1}, Landroid/database/Cursor;->moveToFirst()Z

    move-result v3

    if-eqz v3, :cond_1

    .line 663
    const/4 v3, 0x0

    invoke-interface {v1, v3}, Landroid/database/Cursor;->getInt(I)I

    move-result v0

    .line 665
    :cond_1
    invoke-interface {v1}, Landroid/database/Cursor;->close()V

    .line 666
    return v0
.end method

.method public queryForCommentCountByPostId(I)I
    .locals 6
    .parameter "id"

    .prologue
    .line 357
    new-instance v3, Ljava/lang/StringBuilder;

    const-string v4, "SELECT commentscount FROM "

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    .line 358
    iget-object v4, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->tableName:Ljava/lang/String;

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, " WHERE id = "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v3

    .line 357
    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    .line 360
    .local v2, query:Ljava/lang/String;
    sget-boolean v3, Lcom/opongo/blogapp/manager/DatabaseManager;->DEBUG:Z

    if-eqz v3, :cond_0

    .line 361
    sget-object v3, Lcom/opongo/blogapp/manager/DatabaseManager;->TAG:Ljava/lang/String;

    new-instance v4, Ljava/lang/StringBuilder;

    const-string v5, "Executing query: "

    invoke-direct {v4, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v4, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-static {v3, v4}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 363
    :cond_0
    invoke-virtual {p0, v2}, Lcom/opongo/blogapp/manager/DatabaseManager;->query(Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v1

    .line 364
    .local v1, cursor:Landroid/database/Cursor;
    const/4 v0, 0x0

    .line 365
    .local v0, count:I
    invoke-interface {v1}, Landroid/database/Cursor;->moveToFirst()Z

    move-result v3

    if-eqz v3, :cond_1

    .line 366
    const/4 v3, 0x0

    invoke-interface {v1, v3}, Landroid/database/Cursor;->getInt(I)I

    move-result v0

    .line 368
    :cond_1
    invoke-interface {v1}, Landroid/database/Cursor;->close()V

    .line 369
    return v0
.end method

.method public queryForCommentCountByPrimary(I)I
    .locals 6
    .parameter "_id"

    .prologue
    .line 336
    new-instance v3, Ljava/lang/StringBuilder;

    const-string v4, "SELECT commentscount FROM "

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    .line 337
    iget-object v4, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->tableName:Ljava/lang/String;

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, " WHERE _id = "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v3

    .line 336
    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    .line 339
    .local v2, query:Ljava/lang/String;
    sget-boolean v3, Lcom/opongo/blogapp/manager/DatabaseManager;->DEBUG:Z

    if-eqz v3, :cond_0

    .line 340
    sget-object v3, Lcom/opongo/blogapp/manager/DatabaseManager;->TAG:Ljava/lang/String;

    new-instance v4, Ljava/lang/StringBuilder;

    const-string v5, "Executing query: "

    invoke-direct {v4, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v4, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-static {v3, v4}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 342
    :cond_0
    invoke-virtual {p0, v2}, Lcom/opongo/blogapp/manager/DatabaseManager;->query(Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v1

    .line 343
    .local v1, cursor:Landroid/database/Cursor;
    const/4 v0, -0x1

    .line 344
    .local v0, count:I
    invoke-interface {v1}, Landroid/database/Cursor;->moveToFirst()Z

    move-result v3

    if-eqz v3, :cond_1

    .line 345
    const/4 v3, 0x0

    invoke-interface {v1, v3}, Landroid/database/Cursor;->getInt(I)I

    move-result v0

    .line 347
    :cond_1
    invoke-interface {v1}, Landroid/database/Cursor;->close()V

    .line 348
    return v0
.end method

.method public queryForContentByPrimary(I)Ljava/lang/String;
    .locals 6
    .parameter "_id"

    .prologue
    .line 275
    new-instance v3, Ljava/lang/StringBuilder;

    const-string v4, "SELECT content FROM "

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v4, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->tableName:Ljava/lang/String;

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, " WHERE _id = "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    .line 276
    invoke-virtual {v3, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v3

    .line 275
    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    .line 278
    .local v2, query:Ljava/lang/String;
    sget-boolean v3, Lcom/opongo/blogapp/manager/DatabaseManager;->DEBUG:Z

    if-eqz v3, :cond_0

    .line 279
    sget-object v3, Lcom/opongo/blogapp/manager/DatabaseManager;->TAG:Ljava/lang/String;

    new-instance v4, Ljava/lang/StringBuilder;

    const-string v5, "Executing query: "

    invoke-direct {v4, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v4, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-static {v3, v4}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 281
    :cond_0
    invoke-virtual {p0, v2}, Lcom/opongo/blogapp/manager/DatabaseManager;->query(Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v1

    .line 282
    .local v1, cursor:Landroid/database/Cursor;
    const/4 v0, 0x0

    .line 283
    .local v0, content:Ljava/lang/String;
    invoke-interface {v1}, Landroid/database/Cursor;->moveToFirst()Z

    move-result v3

    if-eqz v3, :cond_1

    .line 284
    const/4 v3, 0x0

    invoke-interface {v1, v3}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v0

    .line 286
    :cond_1
    invoke-interface {v1}, Landroid/database/Cursor;->close()V

    .line 287
    return-object v0
.end method

.method public queryForGUIDByPrimary(I)Ljava/lang/String;
    .locals 6
    .parameter "_id"

    .prologue
    .line 296
    new-instance v3, Ljava/lang/StringBuilder;

    const-string v4, "SELECT guid FROM "

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v4, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->tableName:Ljava/lang/String;

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, " WHERE _id = "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    .line 298
    .local v2, query:Ljava/lang/String;
    sget-boolean v3, Lcom/opongo/blogapp/manager/DatabaseManager;->DEBUG:Z

    if-eqz v3, :cond_0

    .line 299
    sget-object v3, Lcom/opongo/blogapp/manager/DatabaseManager;->TAG:Ljava/lang/String;

    new-instance v4, Ljava/lang/StringBuilder;

    const-string v5, "Executing query: "

    invoke-direct {v4, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v4, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-static {v3, v4}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 301
    :cond_0
    invoke-virtual {p0, v2}, Lcom/opongo/blogapp/manager/DatabaseManager;->query(Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v1

    .line 302
    .local v1, cursor:Landroid/database/Cursor;
    const/4 v0, 0x0

    .line 303
    .local v0, content:Ljava/lang/String;
    invoke-interface {v1}, Landroid/database/Cursor;->moveToFirst()Z

    move-result v3

    if-eqz v3, :cond_1

    .line 304
    const/4 v3, 0x0

    invoke-interface {v1, v3}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v0

    .line 306
    :cond_1
    invoke-interface {v1}, Landroid/database/Cursor;->close()V

    .line 307
    return-object v0
.end method

.method public queryForIdByPrimary(I)I
    .locals 6
    .parameter "_id"

    .prologue
    .line 378
    new-instance v3, Ljava/lang/StringBuilder;

    const-string v4, "SELECT id FROM "

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v4, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->tableName:Ljava/lang/String;

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, " WHERE _id = "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    .line 380
    .local v2, query:Ljava/lang/String;
    sget-boolean v3, Lcom/opongo/blogapp/manager/DatabaseManager;->DEBUG:Z

    if-eqz v3, :cond_0

    .line 381
    sget-object v3, Lcom/opongo/blogapp/manager/DatabaseManager;->TAG:Ljava/lang/String;

    new-instance v4, Ljava/lang/StringBuilder;

    const-string v5, "Executing query: "

    invoke-direct {v4, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v4, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-static {v3, v4}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 383
    :cond_0
    invoke-virtual {p0, v2}, Lcom/opongo/blogapp/manager/DatabaseManager;->query(Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v0

    .line 384
    .local v0, cursor:Landroid/database/Cursor;
    const/4 v1, -0x1

    .line 385
    .local v1, id:I
    invoke-interface {v0}, Landroid/database/Cursor;->moveToFirst()Z

    move-result v3

    if-eqz v3, :cond_1

    .line 386
    const/4 v3, 0x0

    invoke-interface {v0, v3}, Landroid/database/Cursor;->getInt(I)I

    move-result v1

    .line 388
    :cond_1
    invoke-interface {v0}, Landroid/database/Cursor;->close()V

    .line 389
    return v1
.end method

.method public queryForPostById(I)Lcom/opongo/blogapp/common/Post;
    .locals 6
    .parameter "id"

    .prologue
    .line 417
    new-instance v3, Ljava/lang/StringBuilder;

    const-string v4, "SELECT id, title, date, content, categories, commentscount, imageurl, post_order, guid, opened FROM "

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v4, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->tableName:Ljava/lang/String;

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, " WHERE id = "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    .line 419
    .local v2, query:Ljava/lang/String;
    sget-boolean v3, Lcom/opongo/blogapp/manager/DatabaseManager;->DEBUG:Z

    if-eqz v3, :cond_0

    .line 420
    sget-object v3, Lcom/opongo/blogapp/manager/DatabaseManager;->TAG:Ljava/lang/String;

    new-instance v4, Ljava/lang/StringBuilder;

    const-string v5, "Executing query: "

    invoke-direct {v4, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v4, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-static {v3, v4}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 422
    :cond_0
    invoke-virtual {p0, v2}, Lcom/opongo/blogapp/manager/DatabaseManager;->query(Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v0

    .line 423
    .local v0, cursor:Landroid/database/Cursor;
    new-instance v1, Lcom/opongo/blogapp/common/Post;

    invoke-direct {v1}, Lcom/opongo/blogapp/common/Post;-><init>()V

    .line 424
    .local v1, post:Lcom/opongo/blogapp/common/Post;
    invoke-interface {v0}, Landroid/database/Cursor;->moveToFirst()Z

    move-result v3

    if-eqz v3, :cond_1

    .line 425
    const/4 v3, 0x0

    invoke-interface {v0, v3}, Landroid/database/Cursor;->getInt(I)I

    move-result v3

    iput v3, v1, Lcom/opongo/blogapp/common/Post;->id:I

    .line 426
    const/4 v3, 0x1

    invoke-interface {v0, v3}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v3

    iput-object v3, v1, Lcom/opongo/blogapp/common/Post;->title:Ljava/lang/String;

    .line 427
    const/4 v3, 0x2

    invoke-interface {v0, v3}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v3

    iput-object v3, v1, Lcom/opongo/blogapp/common/Post;->date:Ljava/lang/String;

    .line 428
    const/4 v3, 0x3

    invoke-interface {v0, v3}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v3

    iput-object v3, v1, Lcom/opongo/blogapp/common/Post;->content:Ljava/lang/String;

    .line 429
    const/4 v3, 0x4

    invoke-interface {v0, v3}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v3

    iput-object v3, v1, Lcom/opongo/blogapp/common/Post;->categories:Ljava/lang/String;

    .line 430
    const/4 v3, 0x5

    invoke-interface {v0, v3}, Landroid/database/Cursor;->getInt(I)I

    move-result v3

    iput v3, v1, Lcom/opongo/blogapp/common/Post;->commentsCount:I

    .line 431
    const/4 v3, 0x6

    invoke-interface {v0, v3}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v3

    iput-object v3, v1, Lcom/opongo/blogapp/common/Post;->imageUrl:Ljava/lang/String;

    .line 432
    const/4 v3, 0x7

    invoke-interface {v0, v3}, Landroid/database/Cursor;->getInt(I)I

    move-result v3

    iput v3, v1, Lcom/opongo/blogapp/common/Post;->order:I

    .line 433
    const/16 v3, 0x8

    invoke-interface {v0, v3}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v3

    iput-object v3, v1, Lcom/opongo/blogapp/common/Post;->guid:Ljava/lang/String;

    .line 434
    const/16 v3, 0x9

    invoke-interface {v0, v3}, Landroid/database/Cursor;->getInt(I)I

    move-result v3

    iput v3, v1, Lcom/opongo/blogapp/common/Post;->opened:I

    .line 436
    :cond_1
    invoke-interface {v0}, Landroid/database/Cursor;->close()V

    .line 437
    return-object v1
.end method

.method public queryForPostByPrimary(I)Lcom/opongo/blogapp/common/Post;
    .locals 6
    .parameter "_id"

    .prologue
    .line 393
    new-instance v3, Ljava/lang/StringBuilder;

    const-string v4, "SELECT id, title, date, content, categories, commentscount, imageurl, post_order, guid, opened FROM "

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v4, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->tableName:Ljava/lang/String;

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, " WHERE _id = "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    .line 395
    .local v2, query:Ljava/lang/String;
    sget-boolean v3, Lcom/opongo/blogapp/manager/DatabaseManager;->DEBUG:Z

    if-eqz v3, :cond_0

    .line 396
    sget-object v3, Lcom/opongo/blogapp/manager/DatabaseManager;->TAG:Ljava/lang/String;

    new-instance v4, Ljava/lang/StringBuilder;

    const-string v5, "Executing query: "

    invoke-direct {v4, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v4, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-static {v3, v4}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 398
    :cond_0
    invoke-virtual {p0, v2}, Lcom/opongo/blogapp/manager/DatabaseManager;->query(Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v0

    .line 399
    .local v0, cursor:Landroid/database/Cursor;
    new-instance v1, Lcom/opongo/blogapp/common/Post;

    invoke-direct {v1}, Lcom/opongo/blogapp/common/Post;-><init>()V

    .line 400
    .local v1, post:Lcom/opongo/blogapp/common/Post;
    invoke-interface {v0}, Landroid/database/Cursor;->moveToFirst()Z

    move-result v3

    if-eqz v3, :cond_1

    .line 401
    const/4 v3, 0x0

    invoke-interface {v0, v3}, Landroid/database/Cursor;->getInt(I)I

    move-result v3

    iput v3, v1, Lcom/opongo/blogapp/common/Post;->id:I

    .line 402
    const/4 v3, 0x1

    invoke-interface {v0, v3}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v3

    iput-object v3, v1, Lcom/opongo/blogapp/common/Post;->title:Ljava/lang/String;

    .line 403
    const/4 v3, 0x2

    invoke-interface {v0, v3}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v3

    iput-object v3, v1, Lcom/opongo/blogapp/common/Post;->date:Ljava/lang/String;

    .line 404
    const/4 v3, 0x3

    invoke-interface {v0, v3}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v3

    iput-object v3, v1, Lcom/opongo/blogapp/common/Post;->content:Ljava/lang/String;

    .line 405
    const/4 v3, 0x4

    invoke-interface {v0, v3}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v3

    iput-object v3, v1, Lcom/opongo/blogapp/common/Post;->categories:Ljava/lang/String;

    .line 406
    const/4 v3, 0x5

    invoke-interface {v0, v3}, Landroid/database/Cursor;->getInt(I)I

    move-result v3

    iput v3, v1, Lcom/opongo/blogapp/common/Post;->commentsCount:I

    .line 407
    const/4 v3, 0x6

    invoke-interface {v0, v3}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v3

    iput-object v3, v1, Lcom/opongo/blogapp/common/Post;->imageUrl:Ljava/lang/String;

    .line 408
    const/4 v3, 0x7

    invoke-interface {v0, v3}, Landroid/database/Cursor;->getInt(I)I

    move-result v3

    iput v3, v1, Lcom/opongo/blogapp/common/Post;->order:I

    .line 409
    const/16 v3, 0x8

    invoke-interface {v0, v3}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v3

    iput-object v3, v1, Lcom/opongo/blogapp/common/Post;->guid:Ljava/lang/String;

    .line 410
    const/16 v3, 0x9

    invoke-interface {v0, v3}, Landroid/database/Cursor;->getInt(I)I

    move-result v3

    iput v3, v1, Lcom/opongo/blogapp/common/Post;->opened:I

    .line 412
    :cond_1
    invoke-interface {v0}, Landroid/database/Cursor;->close()V

    .line 413
    return-object v1
.end method

.method public queryForTitleByPrimary(I)Ljava/lang/String;
    .locals 6
    .parameter "_id"

    .prologue
    .line 316
    new-instance v3, Ljava/lang/StringBuilder;

    const-string v4, "SELECT title FROM "

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v4, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->tableName:Ljava/lang/String;

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, " WHERE _id = "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    .line 318
    .local v2, query:Ljava/lang/String;
    sget-boolean v3, Lcom/opongo/blogapp/manager/DatabaseManager;->DEBUG:Z

    if-eqz v3, :cond_0

    .line 319
    sget-object v3, Lcom/opongo/blogapp/manager/DatabaseManager;->TAG:Ljava/lang/String;

    new-instance v4, Ljava/lang/StringBuilder;

    const-string v5, "Executing query: "

    invoke-direct {v4, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v4, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-static {v3, v4}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 321
    :cond_0
    invoke-virtual {p0, v2}, Lcom/opongo/blogapp/manager/DatabaseManager;->query(Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v1

    .line 322
    .local v1, cursor:Landroid/database/Cursor;
    const/4 v0, 0x0

    .line 323
    .local v0, content:Ljava/lang/String;
    invoke-interface {v1}, Landroid/database/Cursor;->moveToFirst()Z

    move-result v3

    if-eqz v3, :cond_1

    .line 324
    const/4 v3, 0x0

    invoke-interface {v1, v3}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v0

    .line 326
    :cond_1
    invoke-interface {v1}, Landroid/database/Cursor;->close()V

    .line 327
    return-object v0
.end method

.method public reopen()V
    .locals 1

    .prologue
    .line 140
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    invoke-virtual {v0}, Landroid/database/sqlite/SQLiteDatabase;->isOpen()Z

    move-result v0

    if-nez v0, :cond_0

    .line 141
    iget-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->openHelper:Landroid/database/sqlite/SQLiteOpenHelper;

    invoke-virtual {v0}, Landroid/database/sqlite/SQLiteOpenHelper;->getWritableDatabase()Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v0

    iput-object v0, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    .line 143
    :cond_0
    return-void
.end method

.method public setCatEnable(IZLjava/lang/String;)I
    .locals 8
    .parameter "cat_id"
    .parameter "enable"
    .parameter "column"

    .prologue
    const/4 v3, 0x0

    const/4 v2, 0x1

    .line 670
    new-instance v0, Landroid/content/ContentValues;

    invoke-direct {v0}, Landroid/content/ContentValues;-><init>()V

    .line 671
    .local v0, values:Landroid/content/ContentValues;
    if-eqz p2, :cond_2

    move v1, v2

    :goto_0
    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    invoke-virtual {v0, p3, v1}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 673
    const-string v1, "cat_show_enable"

    invoke-virtual {p3, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_0

    .line 674
    const-string v4, "cat_enable"

    if-eqz p2, :cond_3

    move v1, v2

    :goto_1
    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    invoke-virtual {v0, v4, v1}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 677
    :cond_0
    const-string v1, "cat_enable"

    invoke-virtual {p3, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_1

    if-eqz p2, :cond_1

    .line 678
    const-string v1, "cat_show_enable"

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v4

    invoke-virtual {v0, v1, v4}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 681
    :cond_1
    iget-object v1, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    iget-object v4, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->tableName:Ljava/lang/String;

    const-string v5, "cat_parent=?"

    new-array v6, v2, [Ljava/lang/String;

    .line 682
    invoke-static {p1}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v7

    aput-object v7, v6, v3

    .line 681
    invoke-virtual {v1, v4, v0, v5, v6}, Landroid/database/sqlite/SQLiteDatabase;->update(Ljava/lang/String;Landroid/content/ContentValues;Ljava/lang/String;[Ljava/lang/String;)I

    .line 684
    iget-object v1, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    iget-object v4, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->tableName:Ljava/lang/String;

    const-string v5, "id=?"

    new-array v2, v2, [Ljava/lang/String;

    .line 685
    invoke-static {p1}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v6

    aput-object v6, v2, v3

    .line 684
    invoke-virtual {v1, v4, v0, v5, v2}, Landroid/database/sqlite/SQLiteDatabase;->update(Ljava/lang/String;Landroid/content/ContentValues;Ljava/lang/String;[Ljava/lang/String;)I

    move-result v1

    return v1

    :cond_2
    move v1, v3

    .line 671
    goto :goto_0

    :cond_3
    move v1, v3

    .line 674
    goto :goto_1
.end method

.method public setOpened(II)I
    .locals 8
    .parameter "ID"
    .parameter "opened"

    .prologue
    .line 610
    new-instance v1, Landroid/content/ContentValues;

    invoke-direct {v1}, Landroid/content/ContentValues;-><init>()V

    .line 611
    .local v1, values:Landroid/content/ContentValues;
    const-string v2, "opened"

    invoke-static {p2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v3

    invoke-virtual {v1, v2, v3}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 612
    iget-object v2, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    iget-object v3, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->tableName:Ljava/lang/String;

    const-string v4, "id=?"

    const/4 v5, 0x1

    new-array v5, v5, [Ljava/lang/String;

    const/4 v6, 0x0

    .line 613
    invoke-static {p1}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v7

    aput-object v7, v5, v6

    .line 612
    invoke-virtual {v2, v3, v1, v4, v5}, Landroid/database/sqlite/SQLiteDatabase;->update(Ljava/lang/String;Landroid/content/ContentValues;Ljava/lang/String;[Ljava/lang/String;)I

    move-result v0

    .line 614
    .local v0, result:I
    return v0
.end method

.method public setSpicyDealsDidVote(I)V
    .locals 7
    .parameter "post_id"

    .prologue
    const/4 v4, 0x1

    .line 771
    new-instance v0, Landroid/content/ContentValues;

    invoke-direct {v0}, Landroid/content/ContentValues;-><init>()V

    .line 773
    .local v0, values:Landroid/content/ContentValues;
    const-string v1, "did_vote"

    invoke-static {v4}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 775
    iget-object v1, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    iget-object v2, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->tableName:Ljava/lang/String;

    const-string v3, "id=?"

    new-array v4, v4, [Ljava/lang/String;

    const/4 v5, 0x0

    .line 776
    invoke-static {p1}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v6

    aput-object v6, v4, v5

    .line 775
    invoke-virtual {v1, v2, v0, v3, v4}, Landroid/database/sqlite/SQLiteDatabase;->update(Ljava/lang/String;Landroid/content/ContentValues;Ljava/lang/String;[Ljava/lang/String;)I

    .line 777
    return-void
.end method

.method public updateComment(Lcom/opongo/blogapp/common/Comment;)I
    .locals 7
    .parameter "comment"

    .prologue
    .line 637
    new-instance v0, Landroid/content/ContentValues;

    invoke-direct {v0}, Landroid/content/ContentValues;-><init>()V

    .line 638
    .local v0, values:Landroid/content/ContentValues;
    const-string v1, "parent"

    iget v2, p1, Lcom/opongo/blogapp/common/Comment;->parent:I

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 639
    const-string v1, "postid"

    iget v2, p1, Lcom/opongo/blogapp/common/Comment;->postId:I

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 640
    const-string v1, "content"

    iget-object v2, p1, Lcom/opongo/blogapp/common/Comment;->content:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 641
    const-string v1, "author"

    iget-object v2, p1, Lcom/opongo/blogapp/common/Comment;->author:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 642
    const-string v1, "date"

    iget-object v2, p1, Lcom/opongo/blogapp/common/Comment;->date:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 643
    const-string v1, "gravatarurl"

    iget-object v2, p1, Lcom/opongo/blogapp/common/Comment;->gravatarUrl:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 644
    iget-object v1, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    iget-object v2, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->tableName:Ljava/lang/String;

    const-string v3, "id=?"

    const/4 v4, 0x1

    new-array v4, v4, [Ljava/lang/String;

    const/4 v5, 0x0

    .line 645
    iget v6, p1, Lcom/opongo/blogapp/common/Comment;->id:I

    invoke-static {v6}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v6

    aput-object v6, v4, v5

    .line 644
    invoke-virtual {v1, v2, v0, v3, v4}, Landroid/database/sqlite/SQLiteDatabase;->update(Ljava/lang/String;Landroid/content/ContentValues;Ljava/lang/String;[Ljava/lang/String;)I

    move-result v1

    return v1
.end method

.method public updatePost(Lcom/opongo/blogapp/common/Post;)I
    .locals 7
    .parameter "post"

    .prologue
    const/4 v4, 0x1

    .line 529
    new-instance v0, Landroid/content/ContentValues;

    invoke-direct {v0}, Landroid/content/ContentValues;-><init>()V

    .line 530
    .local v0, values:Landroid/content/ContentValues;
    const-string v1, "title"

    iget-object v2, p1, Lcom/opongo/blogapp/common/Post;->title:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 531
    const-string v1, "date"

    iget-object v2, p1, Lcom/opongo/blogapp/common/Post;->date:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 532
    const-string v1, "content"

    iget-object v2, p1, Lcom/opongo/blogapp/common/Post;->content:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 533
    const-string v1, "categories"

    iget-object v2, p1, Lcom/opongo/blogapp/common/Post;->categories:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 534
    const-string v1, "commentscount"

    iget v2, p1, Lcom/opongo/blogapp/common/Post;->commentsCount:I

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 535
    const-string v1, "imageurl"

    iget-object v2, p1, Lcom/opongo/blogapp/common/Post;->imageUrl:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 536
    const-string v1, "post_order"

    iget v2, p1, Lcom/opongo/blogapp/common/Post;->order:I

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 537
    const-string v1, "guid"

    iget-object v2, p1, Lcom/opongo/blogapp/common/Post;->guid:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 538
    const-string v1, "newpost"

    invoke-static {v4}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 539
    const-string v1, "post_author"

    iget-object v2, p1, Lcom/opongo/blogapp/common/Post;->post_author:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 540
    const-string v1, "post_price"

    iget-wide v2, p1, Lcom/opongo/blogapp/common/Post;->post_price:D

    invoke-static {v2, v3}, Ljava/lang/Double;->valueOf(D)Ljava/lang/Double;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Double;)V

    .line 541
    const-string v1, "post_rating"

    iget-wide v2, p1, Lcom/opongo/blogapp/common/Post;->post_rating:D

    invoke-static {v2, v3}, Ljava/lang/Double;->valueOf(D)Ljava/lang/Double;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Double;)V

    .line 543
    iget-object v1, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    invoke-virtual {v1}, Landroid/database/sqlite/SQLiteDatabase;->isDbLockedByOtherThreads()Z

    move-result v1

    if-nez v1, :cond_0

    iget-object v1, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    invoke-virtual {v1}, Landroid/database/sqlite/SQLiteDatabase;->isDbLockedByCurrentThread()Z

    move-result v1

    if-eqz v1, :cond_1

    .line 544
    :cond_0
    sget-object v1, Lcom/opongo/blogapp/manager/DatabaseManager;->TAG:Ljava/lang/String;

    new-instance v2, Ljava/lang/StringBuilder;

    const-string v3, "DBIsLocked: updatePost "

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget v3, p1, Lcom/opongo/blogapp/common/Post;->id:I

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    .line 546
    :cond_1
    iget-object v1, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    iget-object v2, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->tableName:Ljava/lang/String;

    const-string v3, "id=?"

    new-array v4, v4, [Ljava/lang/String;

    const/4 v5, 0x0

    .line 547
    iget v6, p1, Lcom/opongo/blogapp/common/Post;->id:I

    invoke-static {v6}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v6

    aput-object v6, v4, v5

    .line 546
    invoke-virtual {v1, v2, v0, v3, v4}, Landroid/database/sqlite/SQLiteDatabase;->update(Ljava/lang/String;Landroid/content/ContentValues;Ljava/lang/String;[Ljava/lang/String;)I

    move-result v1

    return v1
.end method

.method public updatePostByColumn(ILjava/lang/String;Ljava/lang/String;)I
    .locals 7
    .parameter "post_id"
    .parameter "col"
    .parameter "value"

    .prologue
    .line 600
    new-instance v0, Landroid/content/ContentValues;

    invoke-direct {v0}, Landroid/content/ContentValues;-><init>()V

    .line 601
    .local v0, values:Landroid/content/ContentValues;
    invoke-virtual {v0, p2, p3}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 602
    iget-object v1, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    iget-object v2, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->tableName:Ljava/lang/String;

    const-string v3, "id=?"

    const/4 v4, 0x1

    new-array v4, v4, [Ljava/lang/String;

    const/4 v5, 0x0

    .line 603
    invoke-static {p1}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v6

    aput-object v6, v4, v5

    .line 602
    invoke-virtual {v1, v2, v0, v3, v4}, Landroid/database/sqlite/SQLiteDatabase;->update(Ljava/lang/String;Landroid/content/ContentValues;Ljava/lang/String;[Ljava/lang/String;)I

    move-result v1

    return v1
.end method

.method public updatePostToBlogtype(JJI)J
    .locals 8
    .parameter "post_id"
    .parameter "blogType"
    .parameter "post_order"

    .prologue
    const/4 v7, 0x1

    .line 565
    new-instance v0, Landroid/content/ContentValues;

    invoke-direct {v0}, Landroid/content/ContentValues;-><init>()V

    .line 567
    .local v0, values:Landroid/content/ContentValues;
    const-string v1, "newpost"

    invoke-static {v7}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 568
    const-string v1, "post_order"

    invoke-static {p5}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 570
    iget-object v1, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    invoke-virtual {v1}, Landroid/database/sqlite/SQLiteDatabase;->isDbLockedByOtherThreads()Z

    move-result v1

    if-eqz v1, :cond_0

    .line 571
    sget-object v1, Lcom/opongo/blogapp/manager/DatabaseManager;->TAG:Ljava/lang/String;

    new-instance v2, Ljava/lang/StringBuilder;

    const-string v3, "DBIsLocked: updatePostToBlogtype "

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v2, p1, p2}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    .line 573
    :cond_0
    iget-object v1, p0, Lcom/opongo/blogapp/manager/DatabaseManager;->db:Landroid/database/sqlite/SQLiteDatabase;

    const-string v2, "post_blogtype"

    const-string v3, "post_id=? AND blogtype_id=?"

    const/4 v4, 0x2

    new-array v4, v4, [Ljava/lang/String;

    const/4 v5, 0x0

    .line 574
    invoke-static {p1, p2}, Ljava/lang/String;->valueOf(J)Ljava/lang/String;

    move-result-object v6

    aput-object v6, v4, v5

    .line 575
    invoke-static {p3, p4}, Ljava/lang/String;->valueOf(J)Ljava/lang/String;

    move-result-object v5

    aput-object v5, v4, v7

    .line 573
    invoke-virtual {v1, v2, v0, v3, v4}, Landroid/database/sqlite/SQLiteDatabase;->update(Ljava/lang/String;Landroid/content/ContentValues;Ljava/lang/String;[Ljava/lang/String;)I

    move-result v1

    int-to-long v1, v1

    return-wide v1
.end method
